chdkfandomcom-20200222-history
USB Remote
Using just an inexpensive push button switch, a converted USB cable, and a small battery, you can construct a remote device that will allow you to control the operation of your CHDK-enabled camera. If you want software control over USB, see PTP Extension Background Since its earliest inception, CHDK has provided a simple method of operating a Canon P&S camera from a remote switch connected to the camera's USB port. Built-in functionality allowed basic "press half" and "press full" actions - with the additional ability to synchronize the release of the shutter between multiple camera connected to a common control unit. There was also a limited remote zoom functionality, useful for coordinating the zoom position when many cameras were connected together. With the passing of time, the code base supporting this functionality had become increasingly complicated and difficult to maintain or extend. To that end, as of August 2012, a new set of functionality has been released. This new version provides a more stable and easy to understand interface and expanded functionality. Introduction The current CHDK version of USB remote operation introduced a modular concept for the selection of what device is connected to the camera and how the camera reacts to that device. A logic block diagram is shown below - click to obtain a full-size view. In operation the state of a remote device connected to the USB port is converted to one the following states: *switch released *switch half pressed *switch full pressed and action is taken based on the output module selected via the CHDK Remote menu. In addition, values indicating number of activations (pulse count) and a duration of each activation (pulse width / pulse gap) is also maintained for use by CHDK scripts. Supported Hardware CHDK now supports the use of several different remote control devices to control a set of camera shooting functions. For basic shooting functions, a simple switch can be used to provide 3V-5V from set of batteries to the USB connector power pin on the jack on your camera. Details about how to build such a device can be found below. In addition to "home made" devices, a commercial product called a Ricoh CA-1 can also be used. These are widely available at camera stores or online from many sources. For more complex operations, devices that produce multiple pulses or pulses of different time duration (width) can be used. These are popular with radio controlled airplane enthusiasts and kite aerial photographers using hardware from vendors like Gentles UK. In addition, using this ability and any of the popular Arduino-type microcontrollers gives almost total flexibility in what your CHDK enable Canon P&S camera can do. Its all up to your imagination and electronics building and programming skills ! A list of sources for USB remote switch devices is posted at the bottom of this page : Links . Homemade USB Remote Cable A popular method for remotely triggering CHDK-enabled cameras involves constructing a simple triggering device from a 3V CR2032 coin battery, a USB extension cable, and a push switch. The camera's USB cable is then attached to the camera at one end and to the triggering device by the other end. Below is a circuit diagram of such a switch. If you are cutting up a commercially-made USB extension cable, then wires 1 and 4 are red and black, respectively, according to the USB standard. It seems that even cheaply made USB cables follow this standard. Note that the 3V CR2032 battery might not be enough to trigger your camera; if not, you may need to use a different power source, e.g. three 1.5V AAA cells connected in series or a spare camera battery like the NB-5L (a 3.7V camera battery). If you are building a book scanner or creating a copy board application, you can also buy one of the little USB chargers you see at the counter and switch the + side of the cable and not worry about batteries. You know you will always have the correct voltage this way. Here's a different schematic, click for a larger view : Note: combined USB & Video Connector Newer Powershots now have a combined USB + video connector; to use both video and USB remote feature a "splitter" cable is necessary. *http://www.achillies.com/CHDK_Files/USB_Splitter.htm *http://chdk.setepontos.com/index.php?topic=294.msg64551#msg64551 The HTC splitter is actually wired correctly for the usb and video composite cable but the non standard shields do not fit the body of the camera or allow the video cable into the connector. You can alter the connector to fit the body if you are VERY CAREFUL and pry off the male connector shield and shave off the edge to fit the camera, then, open the case and pry open the non standard square looking female connector to allow the canon video cable to fit, then press the case back together. Works very well no soldering small parts. Just be careful prying it apart. Homemade USB Remote Cable with Wireless Adapter To make a CHDK remote that will allow you to also connect a Canon wireless remote you need modifiy things a little bit. Colon247 added a 2.5mm jack with 3 connectors, so you can use Canon 2.5mm wireless remote by plugging it into the jack and bypassing the CHDK remote circuit. Improvised USB Remote Using a USB Charger If you should own a portable USB charger with a USB A output, you can use this charger as an improvised USB remote for CHDK. Simply utilize your regular USB cable that you would have used to connect your camera to your computer. In many cases, this is a plain and inexpensive USB A to Mini USB B cable. The sequence of turning the charging currency on and off again will create a "OnePush" event (see below). Configured this way, the CHDK camera will auto-focus when turning the switch to the “on” position, and then take the photo when turning the switch back to the "off" position. While this is certainly kind of clumsy, as you will need to flick a switch back and forth instead of just pressing a button, with a bit of exercise this also works quite nicely for bracket shots. This is by far sufficient for your first experiments with CHDK's USB remote functionality. You can purchase inexpensive battery driven "USB Emergency Charger" devices which have proven to work quite well with CHDK. Enabling USB Remote operation To enable USB remote operation, go to the CHDK Remote parameters menu and select Enable Remote. Note : 'When this option is selected, the USB port on the camera will no longer be available for uploading picture files or PTP operations. Switch Types None Default setting at start-up. Indicates that no USB device is to be monitored. Useful when a script will be interacting with the USB port. OnePush Used with simple switch inputs. Pressing the switch initiates a "half-press" state. Releasing the switch initiates a "full-press" state for 100 mSec. There is no mechanism to cancel a "half-press" once this sequence is started. Also note that the "half press" will timeout after 10 seconds even if USB power is still applied. TwoPush Used with simple switch inputs. Pressing the switch initiates a "half-press" state. Releasing the switch and then immediately pressing the again switch in less than 1/2 second initiates a "full-press" state. Full press state continues while the switch is held. Failing to immediately press the switch the second time will cancel the sequence. CA-1 Used with a Ricoh CA-1 switch device. Half pressing the button causes the CA-1 to create a 30 mSec pulse that initiates a "half press" state. Releasing the switch at that point will generate 2x30 mSec pulses that cancel the shooting sequences. Full pressing the button will create a 150 mSec pulse that will initiate a "full press" state for 100 mSec. Control Modes CHDK control modes support the translation of input device activation sequences into specific camera operations. None Tells CHDK to do nothing with switch inputs. Allows the input devices to operate - useful for scripting modes. Normal Reacts to the state of the input device. On half press it places the camera in "half press" mode to focus, set exposure and flash settings. On full press it places the camera in "full press" mode to take the actual photograph. Supports sync mode - see below. Quick Causes the camera to immediatly enter shooting mode (focus, exposure, flash) and take a picture immediately on the occurance of a "half shoot". Useful for automation projects where the picture should occur as quickly as possible after some condition is detected. Sync not curently available in this mode. Burst Cause the camera to enter continuous shooting mode while a half press is active. Similiar to the built in camera continuous function except much slower and it does not reset each time the camera power is removed. Sync not curently available in this mode. Bracket Uses the CHDK ''Bracketing in Continuous Mode settings on each half press / full press operation, changing the bracketing setting on each shot. Times out after 5 seconds of no operations. Useful for bracketing operations as it does not require settting up camera continuous mode or timer settings, which clear after each camera power cycle. Note that you may need to disable your camera's "Servo AF" mode in the Canon shooting menu for this to work. Sync not available in this mode. Zoom Uses the built-in pulse counting capability of the USB remote code to control zoom operations. The following action happens for the listed pulse counts. 1 pulse = zoom out one step 2 pulses = zoom in one step 3 pulses = shoot 4 pulses = zoom completely out 5 pulses = zoom completely in Note : pulses needs to be "on" for longer than 100 mSec, "off" for longer than 50 mSec and a 500mSec gap indicates the end of the counting period. Sync not currently available in this mode Video If camera is in video shooting mode, activates filming on the first half press. Stops filming on the next half press. If camera has a dedicated video button, will start and stop video using that button rather than the shutter switch. Sync not curently available in this mode. Multi-Camera Synchronization Enable Sync A useful application of CHDK is the ability to connect two or more cameras together via a common USB cable so that their operations can be synchronized. The fact that the cameras are connected in parallel ensures that things happen at approximately the same time. To achieve better synchronization when taking an actual photograph, CHDK has the ability to stop the picture taking process immediately before the image is actually captured. This allows CHDK on several cameras to focus, adjust exposure, setup the flash and then wait for a shared signal to complete the shot (i.e. sync). If the Enable Sync option is set in CHDK then each camera will wait for the final transition of the USB signal ( 5V to 0V ) before shooting. Note : the camera will wait a maximum of 10 seconds for the sync signal. Waiting any longer results in unpredictable bad camera behaviour. Enable Sync Delay To more precisely tune the synchronization between cameras, CHDK allows a precise fixed delay to be added to each camera to adjust for differences in the time each camera takes to finish shooting a picture. The sync delay value is given in units of 0.1 mSec. Notice in the example pictures the use of the "range multiplier" function in the upper right corner of the screenshot - used to more easily change the delay adjustment value. The range multiplier is changed in ALT mode using the zoom in / zoom out keys. '''Developer's note : the USB remote code includes optional code that can be used to calibrate the sync delay units precisely for each camera. Other Settings Enable Script Start Tells CHDK to activate the currently loaded script when the USB remote performs a full press. Useful for repetitive activation of a script without needing to press the shutter button. Bracketing in Continuous Mode A menu link to provide convenient access to the bracketing parameters used in USB remote bracketing mode. USB Remote Timing Diagrams Scripting Interface USB remote V2 provides extended functionationality when using the get_usb_power() function This new functionality is backwards compatible with the get_usb_power function in the stable version of CHDK.. while 1 wait_click 1 if is_key "remote" then shoot wend Calling function get_usb_power with no parameters ( or parameter = 0 ) returns the pulse width of the most recent USB power activation and clears that value. do p = get_usb_power 0 until p>0 Calling function get_usb_power with parameters = 1 returns the current state of USB power ( 0=off, 1=on) do p = get_usb_power 1 until p>0 In addition, it is also possible to return the most recent count of pulses received and a buffered list of pulse width and pulse gap information : do p = get_usb_power 2 until p>0 returns a buffered pulse width or pulse gap value (width values are positive, gap values are negative) do p = get_usb_power 3 until p>0 returns the most recent number of pulses in a window (terminates after 1 second of inactivity) NOTE : changing the yield value used by the script ( see set_yield ) will change the minimum and maximum timing for pulse counts and will change the measured pulse width value. You will need to calibrate these values for each set_yield change you make. Links CHDK Forum *Building a USB Remote Cable - many pages of ideas and pictures here *DIY wireless remote with a chinese door ring bell *USB Remote Shutter using Linear Voltage Regulator *The perfect miniature USB remote? *CHDKremote2 - a two stage remote control adapter for CHDK External Web Sites *Remote Shutter Release Project *Gentles USB Remote Switches *fvdk's USB Remote Wwitches *fvdk's Various SDM / CHDK Remotes with External Port *fvdk's USB Remote YouTube video *Flickr USB Remote Switch Page *Instructable for creating cable release from an Amiga joystick *Short directions for building a cable release using an LED keychain flashlight *DIY Wireless remote with a Chinese remote LED LAMP *CanoRemote : Infrared Remote Control Receiver *digi-dat SDM Canon USB remote *DIY Shutter Release Cable For Canon Cameras with CHDK Video Instructions * bignate84howto CHDK USB Remote Shutter Release * Canon SX30IS CHDK Remote Shutter Release * Plug and Play CHDK Remote Shutter Control SX40 Category:Development Category:Scripting Category:CHDK internals